From: Zygmunt Krynicki Date: Thu, 21 Aug 2025 18:41:55 +0000 (+0000) Subject: interfaces/prompting: handle unsupported xattrs X-Git-Tag: archive/raspbian/2.71-3+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=656c50b5f6299394e9084b4a0e03cbb362625332;p=snapd.git interfaces/prompting: handle unsupported xattrs This happens in Debian build infrastructure: ``` FAIL: requestrules_test.go:748: requestrulesSuite.TestReadOrAssignUserSessionID requestrules_test.go:765: c.Assert(err, IsNil) ... value syscall.Errno = 0x5f ("operation not supported") ``` Most likely the file system under /run is not a tmpfs or is restricted by a sandbox of some sort. Allow tests to detect this condition and skip certain parts. Signed-off-by: Zygmunt Krynicki Gbp-Pq: Name 0010-interfaces-prompting-handle-unsupported-xattrs.patch --- diff --git a/interfaces/prompting/requestrules/requestrules_test.go b/interfaces/prompting/requestrules/requestrules_test.go index 9f66c1d1..b83f24c5 100644 --- a/interfaces/prompting/requestrules/requestrules_test.go +++ b/interfaces/prompting/requestrules/requestrules_test.go @@ -28,6 +28,7 @@ import ( "sort" "strings" "sync" + "syscall" "testing" "time" @@ -762,6 +763,9 @@ func (s *requestrulesSuite) TestReadOrAssignUserSessionID(c *C) { // If there is a user session dir, expect some non-zero user ID origID, err := rdb.ReadOrAssignUserSessionID(1000) + if errors.Is(err, syscall.EOPNOTSUPP) { + c.Skip("xttrs are not supported on this system") + } c.Assert(err, IsNil) c.Assert(origID, Not(Equals), prompting.IDType(0)) @@ -840,14 +844,18 @@ func (s *requestrulesSuite) TestReadOrAssignUserSessionIDConcurrent(c *C) { var startWG sync.WaitGroup startWG.Add(count) resultChan := make(chan prompting.IDType, count) + errChan := make(chan error, count) for i := 0; i < count; i++ { go func() { startWG.Done() <-startChan // wait for broadcast sessionID, err := rdb.ReadOrAssignUserSessionID(5000) - c.Assert(err, IsNil) - c.Assert(sessionID, Not(Equals), prompting.IDType(0)) - resultChan <- sessionID + if err != nil { + errChan <- err + } else { + c.Assert(sessionID, Not(Equals), prompting.IDType(0)) + resultChan <- sessionID + } }() } startWG.Wait() @@ -861,6 +869,11 @@ func (s *requestrulesSuite) TestReadOrAssignUserSessionIDConcurrent(c *C) { case firstID = <-resultChan: c.Assert(firstID, NotNil) c.Assert(firstID, Not(Equals), prompting.IDType(0)) + case err := <-errChan: + if errors.Is(err, syscall.EOPNOTSUPP) { + c.Skip("xttrs are not supported on this system") + } + c.Assert(err, IsNil) case <-time.NewTimer(time.Second).C: c.Fatal("timed out waiting for first user ID") }